import request from '@/utils/request'

const baseUrl = 'system/activity/discount'

/**
 * 分页查询活动折扣
 * @param query
 * @return {*}
 */
export function pageActivityDiscount(query) {
  return request({
    url: baseUrl + '/page', method: 'get', params: query
  })
}

/**
 * 获取折扣
 * @param id
 * @return {AxiosPromise}
 */
export function getActivityDiscount(id) {
  return request({
    url: baseUrl + '/' + id, method: 'get'
  })
}

export function addOrEditActivityDiscount(data) {
  return request({
    url: baseUrl, method: data.discountId ? 'put' : 'post', data
  })
}

/**
 * 获取分页菜品详情
 * @param query
 * @return {AxiosPromise}
 */
export function pageFoodDetail(query) {
  return request({
    url: baseUrl + '/page/food_detail', method: 'get', params: query
  })
}

/**
 * 根据ids删除
 * @param ids
 * @return {*}
 */
export function deleteDiscountsByIds(ids) {
  return request({
    url: baseUrl, method: 'delete', data: ids
  })
}
